﻿using UnityEngine;
using System.Collections;
using System;

public class Player : MonoBehaviour {
    public GameObject bulletPrefab;
    public UserData userdata;
    //public FireData fireData;
    public float speed = 10f;

    public void Move(Vector3 dir)
    {
        transform.Translate(dir * speed * Time.deltaTime);        
    }
    public void Rot(Vector3 rot)
    {
        transform.Rotate(rot * speed * Time.deltaTime*8);
    }
    public void Fire(float press)
    {
        GameObject bullet = Instantiate(bulletPrefab);
        bullet.transform.position = transform.GetChild(3).GetChild(0).position;
        bullet.transform.rotation = transform.GetChild(3).GetChild(0).rotation;
        bullet.GetComponent<Rigidbody>().AddForce(bullet.transform.forward * press );        
    }
}
